/*
 * @Author       : wfl
 * @LastEditors  : wfl
 * @description  :
 * @updateInfo   :
 * @Date         : 2022-11-01 14:58:31
 * @LastEditTime : 2023-07-06 16:19:45
 */
import type { App } from 'vue'

export const registerComponent = (app: App<Element>) => {
  // 所有框架组件单独以包的形式发布
  const comms = import.meta.glob(['@g/components/**/*.vue'], { eager: true })
  Object.keys(comms).forEach((com: keyof typeof comms) => {
    const name = (comms[com] as any).default.name
    name && app.component(name, comms[com] as any)
  })
  const commTsx = import.meta.glob(['@g/components/**/*.tsx'], { eager: true })
  Object.keys(commTsx).forEach((com: keyof typeof commTsx) => {
    const name = (commTsx[com] as any).default.name
    name && app.component(name, commTsx[com] as any)
  })
}
